//
//  LSMainTabBarViewController.swift
//  EasySwift
//
//  Created by 王隆帅 on 2017/6/7.
//  Copyright © 2017年 王隆帅. All rights reserved.
//

import UIKit


class LSMainTabBarViewController: UITabBarController {

    override func viewDidLoad() {
        super.viewDidLoad()

        self.viewControllers = self.getTabViewControllers();
        self.tabBar.tintColor = UIColor.red;
        self.selectedIndex = 1;
        // Do any additional setup after loading the view.
        
    }
    
    func getTabViewControllers() -> Array<UINavigationController> {
        
        let foundationViewController = LSFoundationViewController();
        let uiKitViewController = LSUIKitViewController();
        let thirdVendorViewController = LSThirdVendorViewController();
        
        let foundationNav: UINavigationController = LSMainNavController(rootViewController: foundationViewController);
        let uiKitNav: UINavigationController = LSMainNavController(rootViewController: uiKitViewController);
        let thirdVendorNav: UINavigationController = LSMainNavController(rootViewController: thirdVendorViewController);
        
        let foundationTabbar = UITabBarItem(title: "foundation", image: self.getImgView(imgName: "home_tab_home_btn"), selectedImage: self.getImgView(imgName: "home_tab_home_selected_btn"));
        let uiKitTabbar = UITabBarItem(title: "UI", image: self.getImgView(imgName: "home_tab_saunter_btn"), selectedImage: self.getImgView(imgName: "home_tab_saunter_selected_btn"));
        let thirdnTabbar = UITabBarItem(title: "vendor", image: self.getImgView(imgName: "home_tab_personal_btn"), selectedImage: self.getImgView(imgName: "home_tab_personal_selected_btn"));
      
        foundationNav.tabBarItem = foundationTabbar;
        uiKitNav.tabBarItem = uiKitTabbar;
        thirdVendorNav.tabBarItem = thirdnTabbar;
        
        return[foundationNav, uiKitNav, thirdVendorNav];
    }
    
    func getImgView(imgName: NSString) -> UIImage {
        
        let image: UIImage = UIImage(named: imgName as String)!

        return image;
        
    }

    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
        // Dispose of any resources that can be recreated.
    }
    

    /*
    // MARK: - Navigation

    // In a storyboard-based application, you will often want to do a little preparation before navigation
    override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
        // Get the new view controller using segue.destinationViewController.
        // Pass the selected object to the new view controller.
    }
    */

}
